﻿<!--<div id="mood_mystatus">
	$space[spacenote]
</div>-->

<div id="mood_form" style="width:679px;height:90px;">
	<form method="post" action="cp.php?ac=union&op=add" id="unioninfo_addform">
		<div id="mood_statusinput" style="width:470px;height:90px;float:left;" ><textarea name="message" id="mood_message" onclick="cc();" style="width:440px;height:75px;border:1px solid;" onkeydown="if(event.keyCode == 13 ){ event.returnValue=false;event.cancel = true;$('mood_message').value='';this.blur(); };" >你可以说说你在做什么...</textarea></div>
		<div style="float:left;width:100px;height:100px;">
			<input type="submit" id="mood_add" name="add" value="发表" class="submit" />
			<input type="button" id="mood_faceadd" name="add" value="添加表情" class="submit" style="margin-top:30px;height:25px;" onclick="statusFace();" />
			<input type="hidden" id="addsubmit" name="addsubmit" value="true" />
			<input type="hidden" id="unionadd" name="unionadd" value="true" />
			<input type="hidden" id="unionid" name="unionid" value="<!--{eval echo $unionid;}-->" />
			<input type="hidden" id="refer" name="refer" value="space.php?do=union&id=<!--{eval echo $unionid;}-->" />
			<input type="hidden" id="formhash" name="formhash" value="<!--{eval echo formhash();}-->" />
		</div>
	</form>
</div>


<script type="text/javascript">
	function cc(){
		if($('mood_message').value == '你可以说说你在做什么...'){
			$('mood_message').value = '';
		}
	}
	function statusFace() {
		$('mood_statusinput').style.zIndex = '20005';

		var div = $('mood_face_bg');
		if(div) {
			div.parentNode.removeChild(div);
		}
		div = document.createElement('div');
		div.id = 'mood_face_bg';
		div.style.position = 'absolute';
		div.style.left = div.style.top = '0px';
		div.style.width = '100%';
		div.style.height = document.body.scrollHeight + 'px';
		div.style.backgroundColor = '#000';
		div.style.zIndex = 10000;
		div.style.display = 'none';
		div.style.filter = 'alpha(opacity=0)';
		div.style.opacity = 0;
		div.onclick = function() {
			hiddenstatus();
		}
		$('append_parent').appendChild(div);
	
	
		if($('mood_message_menu') != null) {
			$('mood_message_menu').style.display = '';
		} else {
			var faceDiv = document.createElement("div");
			faceDiv.id = 'mood_message_menu';
			faceDiv.className = 'facebox';
			faceDiv.style.position = 'absolute';
			var faceul = document.createElement("ul");
			for(i=1; i<31; i++) {
				getStatusFace(i, faceul);
			}
			faceDiv.appendChild(faceul);
			$('append_parent').appendChild(faceDiv);
		}
		//定位菜单
		setMenuPosition('mood_message', 0);
		div.style.display = '';
	}

	function hiddenstatus() {
		if($('mood_message_menu') != null) {
			$('mood_message_menu').style.display = 'none';
			$('mood_face_bg').style.display = 'none';
		}
		if($('mood_message').value == ''){
			$('mood_message').value = '你可以说说你在做什么...';
		}
		$('mood_statusinput').style.zIndex = '1';
	}

	function getStatusFace(i, faceul) {
		var faceli = document.createElement("li");
		faceli.innerHTML = '<img src="image/face/'+i+'.gif" style="cursor:pointer; position:relative;" />';
		faceli.getElementsByTagName('img').item(0).onclick = function(){var faceText = '[em:'+i+':]'; if($('mood_message') != null) { insertContent('mood_message', faceText); }};
		faceul.appendChild(faceli);
	}
	
	function sendunion() {
		if($('mood_message').value != '你可以说说你在做什么...' && $('mood_message').value != ''){

			var x = new Ajax();
			var message   = $("mood_message").value;
			var addsubmit = $("addsubmit").value;
			var unionadd  = $("unionadd").value;
			var unionid   = $("unionid").value;
			var formhash  = $("formhash").value;

			x.post('cp.php?ac=union&op=add',"message="+message+"&addsubmit="+addsubmit+"&unionadd="+unionadd+"&unionid="+unionid+"&formhash="+formhash, function(s){

				s = s.replace(/(^\s*)|(\s*$)/g, "");
				var str = eval('('+str+')');

				//$("uinfo_list").firstChild.insertBefore(s);
				//$('newunioninfo').innerHTML = s;
			});

			hiddenstatus();
			$('mood_message').value = '你可以说说你在做什么...';
		}
	}

</script>